function valinput(name, type, regex,require) {
	this.name = name;
	this.type = type;
	this.regex = regex;
	this.require = require;
}

function check(valinputNode, valinput) {
	var emg = document.getElementById("valinput_" + valinput.name);
	if (valinput.require=='true') {
		if (!checkParaValidity(valinputNode.value)) {
			showEmg(emg,"该项不能为空");
		}
	}
	var regex = new RegExp(valinput.regex, 'g');
	if (!regex.test(valinputNode.value)) {
		showEmg(emg, "您的填写不符合要求！");
	}
}

function showEmg(ele, emg) {
	if (ele != null) {
		removeAllChild(ele);
		ele.appendChild(document.createTextNode(emg));
	} else {
		alert(emg);
	}
}

function removeAllChild(parentEle) {
	while (parentEle.firstChild) {
		parentEle.removeChild(element.firstChild);
	}
}

function checkParaValidity(param) {
	if (param == null || param == '' || param == 'null')
		return false;
	return true;
}

/**var names = valinputNode.value + "\n";
	for ( var name in valinput) {
		names += name + ":" + valinput[name] + "\n";
	}
	*/